package com.iceflame.zxingane.funs;

import android.content.Intent;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.adobe.fre.FREObject;
import com.iceflame.zxingane.CaptureActivity;

public class OpenZXing implements FREFunction {

	@Override
	public FREObject call(FREContext arg0, FREObject[] arg1) {
		if(arg1.length == 0){
			return null;
		}
		int width = 0; 
		int height = 0;
		String title = null;
		//String bottom = null;
		try {
			width = arg1[0].getAsInt();
			height = arg1[1].getAsInt();
			title = arg1[2].getAsString();
			//bottom = arg1[3].getAsString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		Intent intent = new Intent();
		intent.putExtra("width", width);
		intent.putExtra("height", height);
		intent.putExtra("title", title);
		//intent.putExtra("bottom", bottom);
		intent.setClass(arg0.getActivity(), CaptureActivity.class);
		arg0.getActivity().startActivity(intent);
		return null;
	}

}
